GridBag Layout
The GridBag layout is the most powerful of all the layout managers. Like the Grid Layout the container's area is split
up into a grid structure. Using the Layout Editor you are able to move components around this grid.
As well as being able to place components anywhere in this grid, you can specify Insets on each
component, specify how the component should grow when its container increases in size, and even
specify how many columns or rows the component should take up.
In the Layout Editor you can apply properties to a collection of components. To select more than one
component, hold down the Shift key and click on each component. Set the properties,
and then apply; each component will be assigned those properties.
By clicking on a component, you will see 8 small boxes surrounding the component. These are
resize handles. Move the mouse over one, hold down the left mouse button, and then drag. You can
make a component cover more than one grid square by dragging the corners around the Layout Editor.
Press the Button below for a GridBagLayout example.